package com.label.Model.Do;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;
import java.util.List;

@TableName("task")
@Data
public class Task {

    @TableId(value = "task_id",type = IdType.ASSIGN_UUID)
    private String taskId;

    @TableField("title")
    private String title;

    @TableField("content")
    private String content;

    @TableField("sender_id")
    private String senderId;

    @TableField("sender_name")
    private String senderName;

    @TableField("count")
    private Integer count;

    @TableField("file_path")
    private String filePath;

    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private Date createTime;

    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private Date updateTime;

    @TableField(exist = false)
    private List<TaskDetail> taskDetails;

    @TableField(exist = false)
    private List<TaskQuestion> taskQuestions;


    public String getType(){//1为小组长或者辅导员0为通知人群
        if(taskDetails!=null && taskDetails.size()!=1)
            return "1";
        return "0";
    }
}
